/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.starter.commons.threadlocal;

import lombok.Data;
import lombok.ToString;

import java.util.Locale;

/**
 *
 * @author zgadmin
 * @date 2025/8/26 15:57
 *
 */
@Data
@ToString
public class UserContext {

    private Long accountId;

    private Long userId;

    private Long appId;

    private boolean admin;

    private boolean superAdmin;

    private String mobile;

    private String name;

    private String userName;

    private Long tenantId;

    private String token;

    private String version;

    private String appKey;

    private long loginTime;

    private boolean isDefault;

    private boolean isBasic;

    private String locale;

    private String traceId;

    private String spanId;

    private int maxSession;

    public static UserContext defaultContext() {
        UserContext userContext = new UserContext();
        userContext.setAccountId(0L);
        userContext.setUserId(0L);
        userContext.setAppId(0L);
        userContext.setMobile(null);
        userContext.setName(null);
        userContext.setUserName("default user");
        userContext.setTenantId(0L);
        userContext.setVersion("1.0");
        userContext.setToken("");
        userContext.setAppKey("");
        userContext.setAdmin(false);
        userContext.setSuperAdmin(false);
        userContext.setBasic(false);
        userContext.setDefault(true);
        userContext.setLocale(Locale.CHINA.toString());
        userContext.setMaxSession(0);
        return userContext;
    }

}